package io.github.aaron.commonadmin.base.vo;

import java.util.Collections;
import java.util.List;

/**
 * @Author: AaronF
 * @Date: 2025/08/25/22:59
 * @Description:
 */
public class PageResult<T> {

    /**
     * 结果集
     */
    private final List<T> result;

    /**
     * 总数
     */
    private final int total;

    protected PageResult(List<T> result,int total){
        this.result = result;
        this.total = total;
    }

    public static <R> PageResult<R> of(List<R> result,int total){
        return new PageResult<>(result,total);
    }

    public static <R> PageResult<R> empty(){
        return new PageResult<>(Collections.emptyList(),0);
    }

    public List<T> getResult() {
        return result;
    }

    public int getTotal() {
        return total;
    }
}
